forcecell 2.2.0
Loading...
Searching...
No Matches
forcecell.h File Reference

This file contains API for Force Cell Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_analog_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  forcecell_t
 Force Cell Click context object. More...
struct  forcecell_cfg_t
 Force Cell Click configuration object. More...

Macros

#define FORCECELL_R6_KOHM   2.7
 Force Cell force calculation setting.
#define FORCECELL_GAIN   ( ( 100 / FORCECELL_R6_KOHM ) + 1 )
#define FORCECELL_SENSITIVITY_V_V   0.025
#define FORCECELL_FULL_SCALE_N   30
#define FORCECELL_NUM_CONVERSIONS   100
 Force Cell default ADC samples number for averaging.
#define FORCECELL_TIMEOUT_MS   2000
 Force Cell timeout setting.
#define FORCECELL_ADC_RESOLUTION   0x0FFF
 Force Cell ADC setting.
#define FORCECELL_VREF_3V3   3.3
#define FORCECELL_VREF_5V   5.0
#define FORCECELL_VREF   FORCECELL_VREF_3V3
#define FORCECELL_SET_DEV_ADDR   0x4D
 Force Cell device address setting.
#define FORCECELL_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.

Enumerations

enum  forcecell_drv_t { FORCECELL_DRV_SEL_ADC , FORCECELL_DRV_SEL_I2C }
 Force Cell Click driver selector. More...
enum  forcecell_return_value_t { FORCECELL_OK = 0 , FORCECELL_ERROR = -1 }
 Force Cell Click return value data. More...

Functions

void forcecell_cfg_setup (forcecell_cfg_t *cfg)
 Force Cell configuration object setup function.
void forcecell_drv_interface_sel (forcecell_cfg_t *cfg, forcecell_drv_t drv_sel)
 Force Cell driver interface setup function.
err_t forcecell_init (forcecell_t *ctx, forcecell_cfg_t *cfg)
 Force Cell initialization function.
err_t forcecell_read_raw_adc (forcecell_t *ctx, uint16_t *raw_adc)
 Force Cell read raw ADC value function.
err_t forcecell_read_voltage (forcecell_t *ctx, float *voltage)
 Force Cell read voltage level function.
err_t forcecell_read_voltage_avg (forcecell_t *ctx, uint16_t num_conv, float *voltage_avg)
 Force Cell read average voltage level function.
err_t forcecell_set_vref (forcecell_t *ctx, float vref)
 Force Cell set vref function.
err_t forcecell_calib_offset (forcecell_t *ctx)
 Force Cell calib offset function.
err_t forcecell_read_force (forcecell_t *ctx, float *force)
 Force Cell read force function.

Detailed Description

This file contains API for Force Cell Click Driver.

Enumeration Type Documentation

◆ forcecell_drv_t

Force Cell Click driver selector.

Selects target driver interface of Force Cell Click driver.

Enumerator
FORCECELL_DRV_SEL_ADC 

ADC driver descriptor.

FORCECELL_DRV_SEL_I2C 

I2C driver descriptor.

◆ forcecell_return_value_t

Force Cell Click return value data.

Predefined enum values for driver return values.

Enumerator
FORCECELL_OK 
FORCECELL_ERROR